package com.chuangke.dev.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chuangke.dev.dao.SysModelColumnMapper;
import com.chuangke.dev.model.SysModelColumn;
import com.chuangke.dev.service.SysModelColumnService;

/**
 * 业务字段 服务层实现
 * 
 * @author chaungke
 */
@Service
public class SysModelColumnServiceImpl extends ServiceImpl<SysModelColumnMapper, SysModelColumn>
		implements SysModelColumnService {

	@Autowired
	private SysModelColumnMapper genTableColumnMapper;

	/**
	 * 查询业务字段列表
	 * 
	 * @return 业务字段集合
	 */
	@Override
	public List<SysModelColumn> listColumnsFromSchemaByTableName(String tableName) {
		return genTableColumnMapper.selectColumnsFromSchemaByTableName(tableName);
	}

	@Override
	public List<SysModelColumn> getColumns(String tableId, List<String> columnNameList) {
		return genTableColumnMapper.selectList(new QueryWrapper<SysModelColumn>().lambda().eq(SysModelColumn::getTableId, tableId).in(SysModelColumn::getColumnName, columnNameList));
	}

}